<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/11/19
  Time: 17:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>地址</title>
</head>
<style>
   body,html ,#allmap {
        width: 100%;
        height: 100%;
        overflow: hidden;
        margin: 0;
        font-family: "微软雅黑";
    }
</style>
<body>
<div id="allmap"></div>
</body>
<script type="text/javascript"
        src="http://api.map.baidu.com/library/AreaRestriction/1.2/src/AreaRestriction_min.js"></script>
<script>
    //百度地图API功能
    function loadJScript() {
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "http://api.map.baidu.com/api?v=2.0&ak=zLeoVeM0TDDQFrPGwtH3Uyfv09K3xFjT&callback=init";
        document.body.appendChild(script);
    }

    function init() {
        var map = new BMap.Map("allmap", {minZoom: 14, maxZoom: 20});            // 创建Map实例
        var point = new BMap.Point(118.110259, 24.490909); // 创建点坐标
        map.centerAndZoom(point, 15);
        map.enableScrollWheelZoom();//启用滚轮放大缩小

        var b = new BMap.Bounds(new BMap.Point(117.027143, 24.080909), new BMap.Point(119.332025, 24.802102));
        try {
            BMapLib.AreaRestriction.setBounds(map, b);
        } catch (e) {
            alert(e);
        }
    }

    window.onload = loadJScript;  //异步加载地图
</script>
</html>
